<?php
   
    /* 登录处理
     * @param uName uPass email 
     * 
     *  */
    header("Content-type:text/html;charset=utf-8");
    require_once '../inc/user.php';

    
    $message="";
    if (isset($_POST["uName"]))
    {
        $uNameCheck=getUserName($_POST["uName"]);
        if (count($uNameCheck)>0) 
        {
            $message="用户注册失败，用户名已存在";
        }
        else
        {
            $result=addRegUser($_POST["uName"], $_POST["email"], $_POST["uPass"]);
            if ($result<=0) {
                $message="用户注册失败";
            }
            else
            {
                $curUser=getUserName($_POST["uName"]);
                setcookie("uId",$curUser["uId"],time()+60,"/");
                header("location:../style/login.php");
                return ;
            }
        }
    }
    else 
    {
        $message="用户名不能为空";
    }
    header("location:../style/errorNew.php?message=$message");
?>